package org.shell.commands;

import java.lang.reflect.Method;
import org.shell.commands.exceptions.CommandException;

public class CommandBuilderImpl extends CommandBuilder {

    private static CommandBuilder builder;

    public static CommandBuilder getCommandBuilder() {
        if (builder == null) {
            builder = new CommandBuilderImpl();
        }
        return builder;
    }

    @Override
    public Command buildCommand(String input) throws CommandException {
        return new InputCommand(input);
    }

    @Override
    public ShellCommand buildCommand(String commandName, Class classInstance, Method methodInstance, String description) throws CommandException {
        return new ShellCommand(commandName, classInstance, methodInstance, description);
    }
}
